package com.echo.register.mapper;

import com.echo.register.domain.VoteCadidate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @program: com.echo.voter
 * @description:
 * @author: Xiaoti
 * @create: 2018-11-01 10:22
 **/
@Mapper
public interface CadidateMapper {

    @Select("select * from vote_cadidate where cadidate_group = #{cadidateGroup} order by cadidate_id")
    List<VoteCadidate> getCadidateList(String cadidateGroup);

    @Select("select * from vote_cadidate where cadidate_id = #{cadidateId}")
    VoteCadidate getCadidateById(String cadidateId);

    @Update("update vote_cadidate set cadidate_total = #{cadidateTotal} where cadidate_id = #{cadidateId}")
    void updateCadidate(VoteCadidate cadidate);
}
